<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page import="com.solution.common.config.PublicConfig"%>
<%@page import="com.solution.admin.home.constants.IndexConstants"%>
<%
	String basePath = PublicConfig.ROOT_PATH;
	String imgRootURL = PublicConfig.IMG_ROOT_URL;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>首页</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta content="zh-cn" http-equiv="content-language" />
<meta content="" name="copyright" />

<link rel="icon" href="<%=basePath%>/statics/images/jx.ico" type="image/x-icon" />
<link rel="shortcut icon" href="<%=basePath%>/statics/images/jx.ico" type="image/x-icon" />
<link rel="bookmark" href="<%=basePath%>/statics/images/jx.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="<%=basePath %>/statics/css/style.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath %>/statics/css/public.css" />
<script charset="utf-8" language="javascript" type="text/javascript" src="<%=basePath %>/statics/js/jquery.1.11.3.min.js"></script>
<script type="text/javascript" src="<%=basePath %>/statics/js/jquery.SuperSlide.2.1.1.js"></script>
<!--[if lte IE 6]> 
<script type="text/javascript" src="js/PNG.js"></script> 
<script> 
PNG.fix('*'); 
</script> 
<![endif]-->

<script type="text/javascript">
	//系统域名 
	var rootPath = '<%=basePath%>';
	// 系统上传文件展示域名
	var imgRootURL = '<%=imgRootURL%>';
	// 百度富文本框根路径
	window.UEDITOR_HOME_URL = rootPath + "/statics/plugins/ueditor/";

	$(function() {

	});
</script>
</head>
<body>
	<c:set var="rootPath" value="<%=basePath %>"></c:set>
	<c:set var="imgRootURL" value="<%=imgRootURL %>"></c:set>
	<div class="wrap">
		<!---头部公共部分开始-->
		<div class="header">
			<div class="nav">
				<div class="nav_con">
					<div class="left">
						<p>欢迎来到景旭商城 &nbsp;&nbsp;<a href="${rootPath}/pc/index" style="color:#999;font-size:12px;">首页</a></p>
 					</div>
					<div class="right">
						<ul id="nav">
							<li><a href="<%=basePath %>/home/loginPage">请登录</a></li>
							<li><a href="<%=basePath %>/reg/toRegPage" style="color: #dd2726">免费注册</a></li>
							<li class="hasdrop"><a href="<%=basePath %>/pc/order/list">我的订单</a>
								<div class="drop">
									<a href="#"> 已购商品 </a>
								</div></li>
							<li><a href="#" onclick="javascript: toMyPage();">个人中心</a></li>
							<li><a href="#" onclick="javascript: toMyFavoritePage();">收藏中心</a></li>
							<li><span style="color: #cccccc; padding: 7px 50px; display: inline-block"></span></li>
							<li class="hasdrop"><a href="#">客服服务<em></em></a>
								<div class="drop">
									<a href="#"> 已购商品 </a>
								</div></li>
							<li><a href="javascript:void(0)" id="purchasingHotline">采购热线：400-026-0123111</a></li>
						</ul>
					</div>
				</div>
			</div>
			<div class="index_header">
				<div class="index_header_con">
					<h1>
						<a href="${rootPath}/pc/index"> <img src="${rootPath}/statics/images/logo.png" />
						</a>
					</h1>
					<div class="search_part">
						<form action="<%=basePath%>/pc/product/search?categoryId=1" id="pcProductSearchForm" name="pcProductSearchForm">
							<div class="search_part1">
								<div class="input_txt">
									<input type="text" class="inputstyle" placeholder="" />
								</div>
								<input type="submit" class="inputbtn" value="搜 索" />
							</div>
						</form>
						<div class="search_part2">
							<p>
								热门搜索： 
							</p>
						</div>
					</div>
					<div class="cart_num">
						<p>
							<a href="${rootPath}/pc/shoppingcart/list"><i></i><span>我的购物车</span><em id="shopCount">0</em></a>
						</p>
					</div>
				</div>
			</div>
			<div class="index_nav">
				<div class="index_nav_con">
					<div id="category" class="category">
						<div class="category-bg"></div>
						<h2>
							<a href="#"> 企业商品分类 </a>
						</h2>
						<div class="cate-list" style="display: block">
							<ul id="J_category" load="1">
								<%--循环商品类型开始 --%>
								<c:forEach items="${categoryList}" var="category">
								<li onmouseover="this.className='hover'" onmouseout="this.className=''">
									<div class="cate-item">
										<h3>
											<a href="#">
												<i>
													<img src="${imgRootURL }${category.categoryImage }?x-oss-process=image/resize,m_pad,h_28,w_28" onerror="this.src='${rootPath}/statics/images/left_icon1.png'"/>
												</i>
												<span>${category.categoryName}</span>
												<em>&gt;</em>
											</a>
										</h3>
									</div>
									<div class="cate-list-expand">
										<div class="c_box">
											<div class="c_left">
												<dl>
													<%--
													<dt>
														<a href="商品列表.htm">子类型</a>
													</dt>
													--%>
													<dd>
														<c:forEach items="${category.subCategoryList}" var="subCategory">
															<a href="${rootPath}/pc/product/search?categoryId=${subCategory.id}">${subCategory.categoryName}</a>
														</c:forEach>
													</dd>
												</dl>
											</div>
											<div class="c_right">
												<a href="${category.advertisementUrl }">
													<img src="${imgRootURL }${category.advertisementImage }"onerror="this.src='${rootPath}/statics/images/ed4.jpg'" />
												</a>
											</div>
										</div>
									</div>

								</li>
								
								</c:forEach>
								<%--循环商品类型结束 --%>
							</ul>
						</div>
					</div>
					<div class="site_nav">
						<ul>
							<li><a href="${rootPath}/pc/index">首页</a></li>
							<li><a href="${rootPath}/pc/product/search">商品列表</a></li>
							<li><a href="${rootPath}/pc/index#sydn">商用电脑</a></li>
							<li><a href="${rootPath}/pc/index#ppg">品牌馆</a></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<!---头部公共部分结束-->
	</div>
<script type="text/javascript">
$(function() {
	//采购热线
	$.ajax({
		type : "post",
		url : "<%=basePath %>/dict/listKeyMapEntites?timesmap=" + new Date().getTime(),
		data: {keyType: 'purchasingHotline'},
		async : true,
		datatype : "json",
		success : function(json) {
			if (json.data.length > 0) {
				$('#purchasingHotline').html('采购热线：' + json.data[0].keyValue);
			}  
		},
		error : function() {
		}
	});
});
</script>
</body>
<script>
$(function() {
	
	/**
	 * 键盘点击事件，回车键，执行搜索
	 */
	$("input.inputstyle").bind('keypress', function(event) {
		if (event.keyCode == "13") {
			var searchKey = $("input.inputstyle").val().trim();
			if(searchKey) {
				$("#pcProductSearchForm").submit();
			} else {
				window.location.href = '<%=basePath%>/pc/product/search?categoryId=1';
			}
		}
	});
	
	/**
	 * 获取购物车数量
	 */
	$.ajax({
		type: 'POST',
		url: rootPath + "/pc/shoppingcart/getShoppingcarCount",
		async: true,
		dataType: 'json',
		success: function(json) {
			if(json.code == '1') {
				$("#shopCount").html(json.data);
			}
		}
	});
});

/**
 * 收藏中心
 */
function toMyFavoritePage() {
	$.ajax({
		type: 'POST',
		url: "<%=basePath %>/home/isLogin",
		async: true,
		dataType: 'json',
		success: function(json) {
			if(json.code == '1') {
				window.location.href='<%=basePath %>/pc/my/favorite';
			} else {
				// layer.msg('请先登录！',{time:1000});
				window.location.href='<%=basePath %>/home/loginPage';
			}
		}
	});
}
/**
 * 个人中心
 */
function toMyPage() {
	$.ajax({
		type: 'POST',
		url: "<%=basePath %>/home/isLogin",
		async: true,
		dataType: 'json',
		success: function(json) {
			if(json.code == '1') {
				window.location.href='<%=basePath %>/pc/my';
			} else {
				/* layer.msg('请先登录！',{time:1000}); */
				window.location.href='<%=basePath %>/home/loginPage';
			}
		}
	});
}

</script>
</html>
